<template>
  <div class="app-container">
    <!-- 输入表单 -->
    <el-form ref="form" label-width="80px">
      <el-form-item label="楼层数目">
        <el-input-number v-model="form_floor.floorCount" :min="0" />
      </el-form-item>
      <el-form-item>
        <el-button
          :disabled="saveBtnDisabled"
          type="primary"
          @click="saveOrUpdate()"
        >
          保存
        </el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import integralGradeAPi from '@/api/core/integral-grade'
export default {
  data() {
    return {
      form_floor: {}, // 初始化数据

      saveBtnDisabled: false, // 保存按钮是否禁用，防止表单重复提交
    }
  },
  created() {},
  methods: {
    saveOrUpdate() {
      // 禁用保存按钮
      this.saveBtnDisabled = true
      this.saveData()
    },
    // 新增数据
    saveData() {
      // debugger
      integralGradeAPi.saveFloor(this.form_floor).then((response) => {
        this.$message({
          type: 'success',
          message: response.message,
        })
        this.$router.push('/core/integral-grade/list')
      })
    },
  },
}
</script>

<style scoped></style>
